<?php

ini_set('error_reporting', E_ERROR );
ini_set('display_errors', 1);
ini_set('log_errors', 0);

define('WSB_PATH', realpath(dirname(__FILE__).'/../../').'/');
define('WSB_APP_PATH', WSB_PATH . 'WSB/');
define('WSB_MODULES_PATH', WSB_APP_PATH . 'modules/');

require_once(WSB_APP_PATH . 'inc/config.php');

$configurations = require(WSB_APP_PATH . 'inc/config.php');

// Include-Pfade
$paths = array();
if(!empty($configurations['includePaths']['zend'])) {
	$paths[] = $configurations['includePaths']['zend'];
}
$paths[] = WSB_PATH;
$paths[] = WSB_APP_PATH . 'library/';
set_include_path(implode(PATH_SEPARATOR, $paths));

// Zend_Loader
require_once('Zend/Loader/Autoloader.php');
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);

// Zend_Config
$config = new Zend_Config($configurations);
Zend_Registry::set('Zend_Config', $config);

// Zend_Db
$db = Zend_Db::factory($config->database);
Zend_Db_Table_Abstract::setDefaultAdapter($db);

// NICHT LOESCHEN!
// Wird beim "Reanimieren" des Models aus der Session benoetigt
require_once(WSB_MODULES_PATH .'member/models/DbTable/Feuser/Row.php');

// Zend_Session
Zend_Session::setOptions(array('save_path' => WSB_APP_PATH . 'tmp/session'));
Zend_Session::start();
